/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package personal.controller;

import java.util.ArrayList;
import java.util.List;
import personal.dao.BookDAO;
import personal.jaxb.Book;
import personal.jaxb.Books;
import personal.xml.JAXBMarshall;
import personal.xml.StAXParserAPI;

/**
 *
 * @author PHATNBSE61057
 */
public class TestingParsingBooks {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
//        JAXBMarshall jm = new JAXBMarshall();
//        jm.marshallCategory("C0004");

        //Using StAX to Search category
//        StAXParserAPI staxp = new StAXParserAPI();
//        List<Book> result = new ArrayList<Book>();
//        result = staxp.searchBookInXMLFile("C0002");
//        if (result == null) {
//            System.out.println("This list is null");
//        }
//        String stext = "There are " + result.size() + " books in this category";
//
//        for (Book book : result) {
//            System.out.println(book.getBookID() + " - " + book.getCategoryID() + " - " + book.getBookName());
//        }
//        System.out.println(stext.toUpperCase());
//        JAXBMarshall jm = new JAXBMarshall();
//        Books books = new Books();
//        books.getBook().addAll(result);
//        jm.marshallCategory(books);
        //======================================================================
//        JAXBMarshall jm = new JAXBMarshall();
//        jm.marshallAllBook();
//        Books books = new Books();
//        BookDAO bDAO = new BookDAO();
//        List<personal.obj.Book> bookE = new ArrayList<personal.obj.Book>();
//        bookE = bDAO.getBookByCategoryID("C0005");
//        for (personal.obj.Book book : bookE) {
//            personal.jaxb.Book jBook = new personal.jaxb.Book();
//            jBook.setBookID(book.getBookID());
//            jBook.setBookAuthor(book.getBookAuthor());
//            jBook.setBookDescription(book.getBookDescription());
//            jBook.setBookDetailedEdition(book.getBookDetailedEdition());
//            jBook.setBookFormat(book.getBookFormat());
//            jBook.setBookISBN(book.getBookISBN());
//            jBook.setBookImg(book.getBookImg());
//            jBook.setBookLink(book.getBookLink());
//            jBook.setBookName(book.getBookName());
//            jBook.setBookPages(book.getBookPages());
//            jBook.setBookPrice(book.getBookPrice());
//            jBook.setBookPublishedDate(book.getBookPublishedDate());
//            jBook.setBookThumb(book.getBookThumb());
//            jBook.setCategoryID(book.getCategoryID());
//            books.getBook().add(jBook);
//        }
//        jm.marshallCategory(books);
        //======================================================================
        
    }
}
